<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >

<head>
    <meta charset="UTF-8">
    <title>管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" type="image/x-icon" th:href="@{/favicon.ico}"/>
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link rel="stylesheet" th:href="@{/css/animate.min.css}">
    <link rel="stylesheet" th:href="@{/iconfont/iconfont.css}">
</head>

<body>

<div class="page-loading">
    <div class="rubik-loader"></div>
</div>

<div class="z-body animated fadeIn">

    <form class="layui-form zadmin-search-area input">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label for="taskName" class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <select name="taskName" id="taskName">
                    </select>
<!--                    <input type="text" name="taskName" autocomplete="off"-->
<!--                           id="taskName" class="layui-input">-->
                </div>
            </div>
            <div class="layui-inline">
                <label for="startDate"  class="layui-form-label">时间</label>
                <div class="layui-input-block">
                    <input type="text" name="startDate" autocomplete="off"
                           id="startDate" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label for="endDate"  class="layui-form-label">至</label>
                <div class="layui-input-block">
                    <input type="text" name="endDate" autocomplete="off"
                           id="endDate" class="layui-input">
                </div>

            </div>
            <div class="layui-inline">
                <div class="layui-input-block">
                <button lay-submit="" lay-filter="search" class="layui-btn layui-btn-sm layui-btn-primary table-action">
                    <i class="zadmin-icon zadmin-icon-search"></i>
                </button>
                </div>
            </div>
        </div>
    </form>

    <table class="layui-hide" id="role-table1"></table>
</div>







<script th:src="@{/lib/jquery/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:src="@{/js/common.js}"></script>

<script>




    layui.config({
        base: '/lib/layui/extend/'
    }).use(['table', 'element', 'dtree', 'form', 'tablePlug','laydate'], function () {
        var table = layui.table;
        var $ = layui.$;
        var dtree = layui.dtree;
        var form = layui.form;
        var tablePlug = layui.tablePlug;
        var laydate = layui.laydate;

        tablePlug.smartReload.enable(true);
        $("#taskName").empty();
        $("#taskName").append("<option value=''>请选择</option>");
        $.ajax({
            type: 'GET',
            headers: {accessToken: sessionStorage.getItem("taskCenterAccessToken"),clientId:sessionStorage.getItem("username")},
            url:'/v1/api/dyTasks/getSelectList'  ,
            // data:{taskId:getQueryString("id")},
            // contentType: "application/json",
            dataType: 'json',
            cache: false,
            async: true,
            success: function(res) {
                // console.log(res)
                var info = res.data ;
                for (var i =0;i<info.length;i++){
                    $("#taskName").append("<option value='"+info[i].name+"'>"+info[i].name+"</option>")
                }
                form.render('select');
            }
        });

        laydate.render({
            elem: '#startDate' ,
            value: layui.util.toDateString(new Date(),"yyyy-MM-dd")
        });

        laydate.render({
            elem: '#endDate',
            value: layui.util.toDateString(new Date(),"yyyy-MM-dd")
        });

        form.on('submit(search)', function (form) {
            table.reload('role-table1', {
                where: form.field
            });
            return false;
        });

        table.render({
            elem: '#role-table1'
            , url: '/v1/api/dyTasks/logsList'
            // , cellMinWidth: 80
            ,headers: {accessToken: sessionStorage.getItem("taskCenterAccessToken"),clientId:sessionStorage.getItem("username")}
            , page: {theme: '#1E9FFF', curr: 1}
            // , toolbar: '#toolbar'
            , smartReloadModel: true
            , cols: [
                [
                      {field: 'id', title: '日志id', width:80}
                    , {field: 'taskName', title: '名称', width:150 }
                    , {field: 'taskBean', title: '任务Bean名称', width:150}
                    , {field: 'taskCron', title: 'cron表达式', width:130}
                    , {field: 'logContent', title: '日志内容' }
                    , {field: 'createDate', title: '创建时间', width:160  }


                ]
            ]
            // ,height: 'full'
        });




    });
</script>
</body>

</html>